function [f] = ObjValue(x)
%ObjValue: Objective Function
%% ALL GLOBAL OPTIMA
%% one-dimensional equal minima
% f = 1-sin(5.*pi.*x).^6;
% % d = 1;
% % x_bound = [0,1];
% % OptSet.sol = [0.1;0.3;0.5;0.7;0.9];
% % OptSet.fval = 0;
% % OptSet.radius = 0.015;
% % precision_init = 0.04; % 0.2
% % MaximalBudget = 50000;
% % precision = [0.023,0.0075,0.0023,0.00075];
%% Himmelblau's function
f = (x(:,1).^2+x(:,2)-11).^2+(x(:,1)+x(:,2).^2-7).^2;
% d = 2;
% x_bound = repmat([-6,6],[d,1]);
% OptSet.sol = [3,2;
%     -2.805118,3.131312;
%     -3.779310,-3.283186;
%     3.584428,-1.848126];
% OptSet.fval = 0;
% OptSet.radius = 0.1;
% precision_init = 0.4; % 3.848
% MaximalBudget = 50000;
% precision = [0.074, 0.024, 0.0074, 0.0024];
%% Modified Rastrigin function
% k = [3,4];
% xn = size(x,1);
% f = sum(10+9.*cos(2.*pi.*repmat(k,[xn,1]).*x),2);
% % d = d;
% % k = [2,2,2,2,2];
% % x_bound = repmat([0,1],[d,1]);
% % solutionId = fullfact(k);
% % OptSet.sol = (2.*solutionId-1)./2./repmat(k,[prod(k),1]);
% % OptSet.fval = d;
% % k=[3,4]: OptSet.radius = 0.01;
% % precision_init = 0.05; % 0.25
% % MaximalBudget = 200000;
% % precision = [0.0096, 0.0030, 0.00096, 0.0003];
% % k=[3,3,3]:  OptSet.radius = 0.01;
% % precision_init = 0.05; % 0.33
% % MaximalBudget = 400000;
% % precision = [0.009, 0.003, 0.0009, 0.0003];
% % k=[2,2,2,2,2]:  OptSet.radius = 0.02;
% % precision_init = 0.1; % 0.5
% % MaximalBudget = 400000;
% % precision = [0.011, 0.0034, 0.0011, 0.00034];
%% Vincent function
% f = 1-mean(sin(10.*log(x)),2);
% % d = d;
% % x_bound = repmat([0.25,10],[d,1]);
% % solutionId = fullfact(ones(1,d).*6);
% % OptSet.sol = exp((4.*solutionId-11)./20.*pi);
% % OptSet.fval = 0;
% % precision_init = 0.08; % 0.2912
% % 2D: OptSet.radius = 0.03;
% % MaximalBudget = 200000;
% % precision = [0.03, 0.0096, 0.003, 0.00096];
% % 3D: OptSet.radius = 0.03;
% % MaximalBudget = 400000;
% % precision = [0.03, 0.0096, 0.003, 0.00096];
%% Shubert function
% [xn,d] = size(x);
% f = zeros(xn,1);
% a = repmat((1:5)',[1,d]);
% for i = 1:xn 
%     f(i) = prod(sum(a.*cos(repmat(x(i,:),[5,1]).*(a+1)+a),1));
% end
% % d = d;
% % x_bound = repmat([-10,10],[d,1]);
% % OptSet.radius = 0.01;
% % precision_init = 0.16; % 0.6248
% % 2D: OptSet.fval = -186.7309;
% % OptSet.sol = [-7.70831,-7.08351; -7.70831,-0.80032; -7.70831,5.48286; -7.08351,-7.70831;
% %     -7.08351,-1.42513; -7.08351,4.85806; -1.42513,-7.08351; -1.42513,-0.80032;
% %     -1.42513,5.48286; -0.80032,-7.70831; -0.80032,-1.42513; -0.80032,4.85806;
% %     4.85806,-7.08351; 4.85806,-0.80032; 4.85806,5.48286; 5.48286,-7.70831;
% %     5.48286,-1.42513; 5.48286,4.85806];
% % MaximalBudget = 200000;
% % precision = [0.0096, 0.003, 0.00096, 0.0003];
% % 3D: OptSet.fval = -2709.0935;
% % OptSet.sol = [-7.70831,-7.08351,-7.08351; -7.70831,-7.08351,-0.80032; -7.70831,-7.08351,5.48286;
% % -7.70831,-0.80032,-7.08351; -7.70831,-0.80032,-0.80032; -7.70831,-0.80032,5.48286;
% % -7.70831,5.48286,-7.08351; -7.70831,5.48286,-0.80032; -7.70831,5.48286,5.48286;
% % -7.08351,-7.70831,-7.08351; -7.08351,-7.70831,-0.80032; -7.08351,-7.70831,5.48286;
% % -7.08351,-7.08351,-7.70831; -7.08351,-7.08351,-1.42513; -7.08351,-7.08351,4.85806;
% % -7.08351,-1.42513,-7.08351; -7.08351,-1.42513,-0.80032; -7.08351,-1.42513,5.48286;
% % -7.08351,-0.80032,-7.70831; -7.08351,-0.80032,-1.42513; -7.08351,-0.80032,4.85806;
% % -7.08351,4.85806,-7.08351; -7.08351,4.85806,-0.80032; -7.08351,4.85806,5.48286;
% % -7.08351,5.48286,-7.70831; -7.08351,5.48286,-1.42513; -7.08351,5.48286,4.85806;
% % -1.42513,-7.08351,-7.08351; -1.42513,-7.08351,-0.80032; -1.42513,-7.08351,5.48286;
% % -1.42513,-0.80032,-7.08351; -1.42513,-0.80032,-0.80032; -1.42513,-0.80032,5.48286;
% % -1.42513,5.48286,-7.08351; -1.42513,5.48286,-0.80032; -1.42513,5.48286,5.48286;
% % -0.80032,-7.70831,-7.08351; -0.80032,-7.70831,-0.80032; -0.80032,-7.70831,5.48286;
% % -0.80032,-7.08351,-7.70831; -0.80032,-7.08351,-1.42513; -0.80032,-7.08351,4.85806;
% % -0.80032,-1.42513,-7.08351; -0.80032,-1.42513,-0.80032; -0.80032,-1.42513,5.48286;
% % -0.80032,-0.80032,-7.70831; -0.80032,-0.80032,-1.42513; -0.80032,-0.80032,4.85806;
% % -0.80032,4.85806,-7.08351; -0.80032,4.85806,-0.80032; -0.80032,4.85806,5.48286;
% % -0.80032,5.48286,-7.70831; -0.80032,5.48286,-1.42513; -0.80032,5.48286,4.85806;
% % 4.85806,-7.08351,-7.08351; 4.85806,-7.08351,-0.80032; 4.85806,-7.08351,5.48286;
% % 4.85806,-0.80032,-7.08351; 4.85806,-0.80032,-0.80032; 4.85806,-0.80032,5.48286;
% % 4.85806,5.48286,-7.08351; 4.85806,5.48286,-0.80032; 4.85806,5.48286,5.48286;
% % 5.48286,-7.70831,-7.08351; 5.48286,-7.70831,-0.80032; 5.48286,-7.70831,5.48286;
% % 5.48286,-7.08351,-7.70831; 5.48286,-7.08351,-1.42513; 5.48286,-7.08351,4.85806;
% % 5.48286,-1.42513,-7.08351; 5.48286,-1.42513,-0.80032; 5.48286,-1.42513,5.48286;
% % 5.48286,-0.80032,-7.70831; 5.48286,-0.80032,-1.42513; 5.48286,-0.80032,4.85806;
% % 5.48286,4.85806,-7.08351; 5.48286,4.85806,-0.80032; 5.48286,4.85806,5.48286;
% % 5.48286,5.48286,-7.70831; 5.48286,5.48286,-1.42513; 5.48286,5.48286,4.85806];
% % MaximalBudget = 400000;
% % precision = [0.002, 0.00064, 0.0002, 0.000064];


%% MANY LOCAL OPTIMA
%% one-dimensional increasing minima
% f = 1-exp(-2.*log(2).*((x-0.08)./0.854).^2).*(sin(5.*pi.*(x.^(3/4)-0.05)).^6);
% % d = 1;
% % x_bound = repmat([0,1],[d,1]);
%% Six-hump camel back
% f = 4.*((4-2.1.*x(:,1).^2+x(:,1).^4./3).*x(:,1).^2+x(:,1).*x(:,2)+(4.*x(:,2).^2-4).*x(:,2).^2);
% % d = 2;
% % x_bound = [-1.9,1.9;-1.1,1.1]
%% Shekel's foxholes
% a = 16.*(mod(0:24,5)-2);
% b = 16.*(floor((0:24)./5)-2);
% xn = size(x,1);
% f = zeros(xn,1);
% for i = 1:xn
%     temp = 1+(0:24)+(x(i,1)-a).^6+(x(i,2)-b).^6;
%     f(i) = 1./(0.002+sum(1./temp));
% end
% % d = 2;
% % x_bound = repmat([-65.536,65.535],[d,1])
%% Griewank function
% d = size(x,2);
% f = 1+1/4000.*sum(x.^2,2)-prod(cos(x./repmat(sqrt(1:d),[size(x,1),1])),2);
% % d = 2;
% % x_bound = repmat([-5,5],[d,1]);
%% Rastrigin function
% d = size(x,2);
% A = 10;
% f = A*d+sum(x.^2-A.*cos(2.*pi.*x),2);
% % d = d;
% % x_bound = repmat([-5.12,5.12],[d,1]);


%% CONTINUOUS OPTIMA PROBLEMS
%% Schaffer's function
% f = 0.5+(sin(sqrt(sum(x.^2,2))).^2-0.5)./((1+0.001.*(sum(x.^2,2))).^2);
% % d = 2;
% % x_bound = repmat([-10,10],[d,1]);
%% Michalewicz
% f = -sin(x(:,1)).*(sin(x(:,1).^2./pi).^20)+sin(x(:,2)).*(sin(x(:,2).^2.*2./pi).^20);
% % d = 2;
% % x_bound = repmat([0,pi],[d,1]);

end